package com.yljk.homedoctor.model;

import com.yilijk.base.base.BaseModel;
import com.yilijk.base.network.RequestParams;
import com.yilijk.base.network.https.HttpCallBack;
import com.yilijk.base.network.https.HttpUtils;
import com.yljk.homedoctor.model.entity.ConsultingReminBean;
import com.yljk.homedoctor.model.entity.DoctorTirmEntity;
import com.yljk.homedoctor.model.entity.DrugShareEntity;
import com.yljk.homedoctor.model.entity.HomeDoctorDetailEntity;
import com.yljk.homedoctor.model.entity.LiveListEntity;
import com.yljk.homedoctor.model.entity.ScanEntity;
import com.yljk.homedoctor.model.entity.live.LiveTabBean;
import com.yljk.servicemanager.bean.ProtocalEntity;
import com.yljk.servicemanager.constants.UrlApi;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by SHICHENG
 * <p>
 * Time on
 */
public class HomeModel extends BaseModel {


    String doctorDetail = "/vbp-doctor/doctor/home/detail";
    public void getDoctorDetail(HttpCallBack<HomeDoctorDetailEntity> callBack){
        RequestParams requestParams = new RequestParams();
        requestParams.put("pageIndex", 0);
        requestParams.put("pageSize", 10);
        HttpUtils.post(doctorDetail,requestParams,callBack);
    }


    public void getCheckPreserveAgreement(HttpCallBack<String> callBack){
        RequestParams jsonObject = new RequestParams();
        jsonObject.put("documentNoList", "[\"yszcxy\",\"flsmjyszc\",\"ysdjgbalwxy\"]");
        HttpUtils.get(UrlApi.checkPreserveAgreement, jsonObject, callBack);
    }

    public void getPreserveAgreeBt(HttpCallBack<String> callBack){
        RequestParams jsonObject = new RequestParams();
        jsonObject.put("documentNoList", "[\"yszcxy\",\"flsmjyszc\",\"ysdjgbalwxy\"]");
        HttpUtils.get(UrlApi.preserveAgreement, jsonObject, callBack);
    }

    public void getDoctorConfirm(String doctorPassportId,HttpCallBack<DoctorTirmEntity> callBack){
        RequestParams jsonObject = new RequestParams();
        jsonObject.put("doctorPassportId", doctorPassportId);
        HttpUtils.get(UrlApi.doctorConfirm, jsonObject, callBack);
    }

    public void getLiveTabList(HttpCallBack<LiveTabBean> callBack){
        RequestParams jsonObject = new RequestParams();
        jsonObject.put("page_name", "doctor_home_app");
        HttpUtils.get(UrlApi.live_index, jsonObject, callBack);
    }

    public void getLiveList(String id,HttpCallBack<LiveListEntity> callBack){
        RequestParams jsonObject = new RequestParams();
        jsonObject.put("category_id", id);
        HttpUtils.get(UrlApi.live_list, jsonObject, callBack);
    }

    public void getScanInfo(HttpCallBack<ScanEntity> callBack){
        HttpUtils.post(UrlApi.temporaryQrcode, callBack);
    }
    public void getUpdataIsProcess(long doctorpassportId,int i,HttpCallBack<String> callBack){
        RequestParams jsonObject = new RequestParams();
        jsonObject.put("passportId", doctorpassportId);
        jsonObject.put("isNoProcess", i);
        HttpUtils.get(UrlApi.updateIsNoProcess, jsonObject, callBack);
    }

    public void getDoctorGuideDetail(String s,HttpCallBack<ProtocalEntity> callBack){
        RequestParams params = new RequestParams();
        params.put("documentNo", s);
        HttpUtils.get(UrlApi.getByDocumentNo, params, callBack);
    }

    public void getDrugShare(HomeDoctorDetailEntity.DataBean.DoctorPacketSetsListBean commonEntities,long doctorPassportId,String doctorName,HttpCallBack<DrugShareEntity> callBack){
        JSONObject jsonObject = new JSONObject();
        RequestParams jsonObject1 = new RequestParams();
        try {
            jsonObject.put("goodsUrl", commonEntities.getName());
            jsonObject.put("desc", commonEntities.getImageUrl());
            jsonObject.put("scene", commonEntities.getPacketId() + "P" + doctorPassportId);
            jsonObject.put("page", "suborder/payshare/main");

            jsonObject1.put("doctorPassportId", doctorPassportId);
            jsonObject1.put("goodsPath", commonEntities.getImageUrl());
            jsonObject1.put("goodsName", commonEntities.getName());
            jsonObject1.put("goodsId", commonEntities.getCommodityId());
            jsonObject1.put("doctorQr", "");
            jsonObject1.put("doctorName", doctorName);
            jsonObject1.put("poster", jsonObject);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        HttpUtils.post(UrlApi.SharePacket, jsonObject1, callBack);
    }

    public void getHealthData(HttpCallBack<ConsultingReminBean> callBack) {
        String healthUrl = "/vbp-doctor/doctor/consultingremind/consultingRemind";
        HttpUtils.get(healthUrl, callBack);

    }
}
